package com.project.controller.sellCountController;

import com.project.bean.*;
import com.project.service.sellCountService.ISellCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sellCount")
public class SellCountController {
    @Autowired
    private ISellCountService sellCountService;

    @RequestMapping("/findGoodsNumByType")
    public List<StoreCountBean> findGoodsNumByType(String year, String month, int storeId) {
        if(year == null || month == null){
            return null;
        }
        return sellCountService.findGoodsNumByType(year, month, storeId);
    }

    @RequestMapping("/findServeNumByType")
    public List<StoreCountBean> findServeNumByType(String year, String month, int storeId) {
        if(year == null || month == null){
            return null;
        }
        return sellCountService.findServeNumByType(year, month, storeId);
    }

    @RequestMapping("/findAllGoodsByYear")
    public List<ManagerCountBean> findAllGoodsByYear(String year) {
        return sellCountService.findAllGoodsByYear(year);
    }


    @RequestMapping("/findAllServeByYear")
    public List<ManagerCountBean> findAllServeByYear(String year) {
        return sellCountService.findAllServeByYear(year);
    }

    @RequestMapping("/findAllGoodsByCity")
    public List<ManagerCityCountBean> findAllGoodsByCity(String year) {
        return sellCountService.findAllGoodsByCity(year);
    }


    @RequestMapping("/findAllServeByCity")
    public List<ManagerCityCountBean> findAllServeByCity(String year) {
        return sellCountService.findAllServeByCity(year);
    }
}
